(function (angular) {
    'use strict';
    angular.module('fs.menu', ['fs.common', 'ui.bootstrap', 'menu/menuNav.html', 'menu/menuTemplate.html', 'menu/menuItemsTemplate.html'])

    angular.module("menu/menuNav.html", []).run(["$templateCache", function ($templateCache) {
        $templateCache.put('menu/menuNav.html', ''
            + '<div class="fs-nav" ng-if="$state.current.name">'
            + '    <ul class="list-inline">'
            + '        <li><a href="#" ng-click="go(\'waf.home\')"><span>{{\'menu.home\'|translate}}</span></a>'
            + '            <i ng-if="navs.length > 0" class="icon icon-arrow-right"></i>'
            + '        </li>'
            + '        <li ng-repeat="navItem in fsNavController.navs">'
            + '            <span>{{navItem|translate}}</span><span ng-if="pageDescription && $index == (navs.length - 1)">&nbsp;({{pageDescription | encode}})</span>'
            + '            <i ng-if="$index < (navs.length - 1)" class="icon icon-arrow-right"></i>'
            + '        </li>\n'
            + '    </ul>'
            + '</div>\n');
    }]);

    angular.module("menu/menuTemplate.html", []).run(["$templateCache", function ($templateCache) {
        $templateCache.put('menu/menuTemplate.html', ''
            + '<ul class="nav navbar-nav">'
            + '    <li class="top-menu" ng-class="{\'current\':isCurrent(menu.subMenuItems)}" uib-dropdown role="menu" is-open="menu.isOpen" ng-repeat="menu in fsMenu track by $index">\n'
            + '        <a href="#" data-toggle="dropdown" uib-dropdown-toggle ng-class="{\'dropup\': menu.isOpen}">\n'
            + '        	   <span ng-if="app.settings.leftMenu" class="icon icon-{{menu.icon}}"></span>\n'
            + '            <span ng-if="!app.settings.collapseLeftMenu">{{menu.displayName|translate}}</span>\n'
            + '            <span ng-class="{\'pull-right\':app.settings.leftMenu}"><span class="caret"></span></span>\n'
            + '        </a>\n'
            + '        <div fs-menu-items class="fs-menu-items" ng-model="menu.subMenuItems" is-open="menu.isOpen"></div>\n'
            + '    </li>\n'
            + '    <li ng-if="app.settings.leftMenu">\n'
            + '        <a ng-click="collapseLeftMenu()">'
            + '            <span ng-class="{\'icon-colse-left\': !app.settings.collapseLeftMenu, \'icon-open-left\': app.settings.collapseLeftMenu}"></span>\n'
            + '        </a>\n'
            + '    </li>\n'
            + '</ul>\n');
    }]);
    angular.module("menu/menuItemsTemplate.html", []).run(["$templateCache", function ($templateCache) {
        $templateCache.put('menu/menuItemsTemplate.html', ''
            + '<ul class="animated fadeInUp" uib-dropdown-menu role="menu">'
            + '    <li class="divider" ng-if="!!item.separator"></li>'
            + '    <li role="menuItem" ng-repeat="item in fsMenu track by $index" ng-class="{\'dropdown-submenu\':!item.actionName, \'open\':open(item)}" ng-if="!item.separator">'
            + '          <a href="#" ng-click="toggleDropdown($event, item)">'
            + '              <span>{{item.displayName|translate}}</span>'
            + '          </a>\n'
            + '          <div fs-menu-items ng-if="item.subMenuItems" ng-model="item.subMenuItems" is-open="menu.isOpen"></div>\n'
            + '    </li>\n'
            + '</ul>\n');
    }]);
})(angular);